package wowraidmanager.client.wishlist.top;

import java.util.ArrayList;

import wowraidmanager.client.wishlist.utils.RaidbossDroplistUtil;
import wowraidmanager.shared.model.wishlist.Member;
import wowraidmanager.shared.model.wishlist.RaidbossDroplist;
import wowraidmanager.shared.model.wishlist.UserStatus;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.Widget;

public class TopRaidzone extends Composite{

    private static TopRaidzoneUiBinder uiBinder = GWT.create(TopRaidzoneUiBinder.class);

    interface TopRaidzoneUiBinder extends UiBinder<Widget, TopRaidzone>{
    }

    String gameVersion;

    UserStatus userStatus;

    ArrayList<RaidbossDroplist> raidzonedroplist;

    ArrayList<Member> guildMember;

    @UiField
    TabPanel raidzoneTab;

    public TopRaidzone(String gameVersion, UserStatus userStatus, ArrayList<RaidbossDroplist> raidzonedroplist, ArrayList<Member> guildMember){
        initWidget(uiBinder.createAndBindUi(this));
        this.gameVersion = gameVersion;
        this.userStatus = userStatus;
        this.raidzonedroplist = raidzonedroplist;
        this.guildMember = guildMember;
        setTabPanel();
    }

    private void setTabPanel(){
        ArrayList<String> raidzoneList = RaidbossDroplistUtil.getRaidzone(raidzonedroplist);
        for(String raidzone:raidzoneList){
            ArrayList<RaidbossDroplist> newRaidzoneDroplist = RaidbossDroplistUtil.getRaidbossdroplistRaidzone(raidzonedroplist, raidzone);
            raidzoneTab.add(new TopBossInfo(raidzone, userStatus, newRaidzoneDroplist, guildMember), raidzone);
        }
        raidzoneTab.selectTab(0);

    }

}
